{extend name="public/layer_base"}

{block name="style"}
{/block}

{block name="main"}
<form action="{:url('save_article')}" method="post" class="form form-horizontal" id="form-send" enctype="multipart/form-data">
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>文章标题：</label>
        <div class="formControls col-xs-8 col-sm-9">
            <input type="text" class="input-text" name="title" value="{$data.title|default=''}">
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>作者：</label>
        <div class="formControls col-xs-8 col-sm-9">
            <input type="text" class="input-text" name="author" value="{$data.author|default=''}">
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>日期：</label>
        <div class="formControls col-xs-8 col-sm-9">
            <input type="text" class="input-text" name="create_time" value="{gt name='data.create_time|default="0"' value='0'}{$data.create_time|date='Y-m-d',###}{/gt}">
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>点击数：</label>
        <div class="formControls col-xs-8 col-sm-9">
            <input type="text" class="input-text" name="hits" value="{$data.hits|default=''}">
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>分类：</label>
        <div class="formControls col-xs-8 col-sm-9"> <span class="select-box">
            <select class="select" name="page_category_id">
                <option value="0">请选择</option>
                {volist name="cate" id="vo"}
                <option value="{$vo.id}" {eq name="data.page_category_id|default=0" value="$vo['id']"} selected {/eq}>{$vo.name}</option>
                {/volist}
            </select>
            </span>
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2">简介：</label>
        <div class="formControls col-xs-8 col-sm-9">
           <textarea style="width: 80%; height: 50px;" name="desc">{$data->desc|default=''}</textarea>
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2">详细内容：</label>
        <div class="formControls col-xs-8 col-sm-9">
            <script id="editor" type="text/plain" style="width:100%;height:400px;">{$data->content|default=''}</script>
        </div>
    </div>
    <div class="row cl">
        <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
            <button class="btn btn-primary radius send_btn" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交</button>
            <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
        </div>
    </div>
    <textarea name="content" style="display: none;">{$data->content|default=''}</textarea>
    <input type="hidden" name="id" value="{$data.id|default=0}" />
    <input type="hidden" name="__token__" value="{$Request.token}" />
</form>
{/block}

{block name="javascript"}
<script type="text/javascript">
$(function(){

    var ue = UE.getEditor('editor');

    $(".send_btn").click(function () {
        $('textarea[name="content"]').val(ue.getContent());
    });
});
</script>
{/block}